<?php session_start(); ?>
<!DOCTYPE html>
<!--[if lt IE 7 ]>
<html class="ie ie6" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7 ]>
<html class="ie ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8 ]>
<html class="ie ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=9"/>
    <title><?php wp_title('|', true, 'right'); ?></title>

    <link rel="shortcut icon" href="<?php echo THEME_URL ?>/images/favicon.png" type="image/x-icon"/>

    <meta name="author" content="Seoweb24h.com">
    <!-- Mobile Specific Metas
          ================================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!--[if lt IE 9]>
    <script src="<?php echo THEME_URL ?>/js/html5.js"></script>
    <script src="<?php echo THEME_URL ?>/js/IE9.js"></script>
    <link rel="stylesheet" href="<?php echo THEME_URL ?>/css/font-awesome-ie7.css">
    <![endif]-->

    <?php $active_option = get_option('azio_style_option', 'option_not_set'); ?>

    <link id="custom-style" rel="stylesheet" href="<?php echo THEME_URL ?>/css/styles/<?php echo $active_option->color ?>.css" media="screen">

    <?php wp_head(); ?>
</head>
<body class="<?php echo $active_option->body; ?>">


<div id="wrapper">

<?php if (current_user_can('manage_options')): ?>
    <div id="demo-panel">
        <form action="#" method="post" id="frm-theme-style">
            <span aria-hidden="true" data-icon="&#xe01c;" class="panle-toggle icomoon"></span>

            <div><a id="save-style" class="config-style-btn save-style-btn">Lưu giao diện</a></div>
            <div><a id="restore-default-style" class="config-style-btn restore-style-btn">Mặc định</a></div>

            <h5>Chọn màu</h5>

            <input type="hidden" id="get-color-style" value="<?php echo $active_option->color ?>"/>

            <div class="style-preview yellow-box" data-style="yellow"></div>
            <div class="style-preview red-box" data-style="red"></div>
            <div class="style-preview blue-box" data-style="blue"></div>
            <div class="style-preview rose-box" data-style="rose"></div>
            <div class="style-preview green-box" data-style="green"></div>
            <div class="style-preview brown-box" data-style="brown"></div>
            <div class="style-preview deep-blue-box" data-style="deep-blue"></div>
            <div class="style-preview orange-box" data-style="orange"></div>

            <h5>Chọn mẫu</h5>
            <select name="pattren-for" id="pattren-for">
                <option value="body" data-area="body">Hình nền toàn trang</option>
                <option value="#top-wrapper" data-area="top-wrapper">Hình nền thanh liên hệ</option>
                <option value="header" data-area="header">Hình nền header</option>
                <option value="#main-container .page-top-leader" data-area="page-top-leader">Hình nền tiêu đề trang</option>
                <option value="#main-container" data-area="main-container">Hình nền phần chính</option>
                <option value="footer" data-area="footer">Hình nền footer</option>
            </select>

            <div class="pattern-preview p1" data-style="p1"></div>
            <div class="pattern-preview p2" data-style="p2"></div>
            <div class="pattern-preview p3" data-style="p3"></div>
            <div class="pattern-preview p4" data-style="p4"></div>
            <div class="pattern-preview p5" data-style="p5"></div>
            <div class="pattern-preview p6" data-style="p6"></div>
            <div class="pattern-preview p7" data-style="p7"></div>
            <div class="pattern-preview p8" data-style="p8"></div>
            <div class="pattern-preview p9" data-style="p9"></div>
            <div class="pattern-preview p10" data-style="p10"></div>
            <div class="pattern-preview p11" data-style="p11"></div>
            <div class="pattern-preview p12" data-style="p12"></div>
            <div class="pattern-preview p13" data-style="p13"></div>
            <div class="pattern-preview p14" data-style="p14"></div>
            <div class="pattern-preview p15" data-style="p15"></div>
            <div class="pattern-preview p16" data-style="p16"></div>
            <div class="pattern-preview p17" data-style="p17"></div>
            <div class="pattern-preview p18" data-style="p18"></div>
            <div class="pattern-preview p19" data-style="p19"></div>
            <div class="pattern-preview p20" data-style="p20"></div>
            <div class="pattern-preview p21" data-style="p21"></div>
            <div class="pattern-preview p22" data-style="p22"></div>
            <div class="pattern-preview p23" data-style="p23"></div>
            <div class="pattern-preview p24" data-style="p24"></div>
            <div class="pattern-preview p25" data-style="p25"></div>
            <div class="pattern-preview p26" data-style="p26"></div>
            <div class="pattern-preview p27" data-style="p27"></div>
            <div class="pattern-preview p28" data-style="p28"></div>
            <div class="pattern-preview p29" data-style="p29"></div>
            <div class="pattern-preview p30" data-style="p30"></div>
            <div class="pattern-preview p31" data-style="p31"></div>
            <div class="pattern-preview p32" data-style="p32"></div>

            <input type="hidden" id="get-pattern-body" value="<?php echo $active_option->body ?>"/>
            <input type="hidden" id="get-pattern-top-wrapper" value="<?php echo $active_option->top_wrapper ?>"/>
            <input type="hidden" id="get-pattern-header" value="<?php echo $active_option->header ?>"/>
            <input type="hidden" id="get-pattern-page-top-leader" value="<?php echo $active_option->page_top_leader ?>"/>
            <input type="hidden" id="get-pattern-main-container" value="<?php echo $active_option->main_container ?>"/>
            <input type="hidden" id="get-pattern-footer" value="<?php echo $active_option->footer ?>"/>
        </form>
    </div>
    <script type="text/javascript">
        jQuery(document).ready(function ($) {

            $('.panle-toggle').click(function () {
                $('#demo-panel').toggleClass('hide-panel');

                if ($('#demo-panel').hasClass('hide-panel')) {
                    $('#demo-panel').animate({'left': 0});
                } else {
                    $('#demo-panel').animate({'left': -180});
                }
            });
            $('.style-preview').click(
                function () {
                    var style = $(this).data('style');
                    $('#custom-style').attr('href', '<?php echo THEME_URL ?>/css/styles/' + style + '.css');
                    $('#get-color-style').val(style);
                });

            $('.pattern-preview').click(
                function () {

                    var tTag = $('#pattren-for').val();
                    var pattBg = $(this).css('background-image');
                    $(tTag).css({'background-image': pattBg});

                    //alert($('#pattren-for').find('option:selected').data('area'));

                    var area = $('#pattren-for').find('option:selected').data('area');
                    var pattern = $(this).data('style');
                    $('#get-pattern-' + area).val(pattern);

                });


        });
    </script>
<?php endif; // if user can manage ?>

<span aria-hidden="true" data-icon="&#xe001;" class="slide-toggle icomoon"></span> <span aria-hidden="true"
                                                                                         data-icon="&#xe010;"
                                                                                         class="gotoTop icomoon"></span>

<div id="top-wrapper" class="<?php echo $active_option->top_wrapper; ?>">
    <div class="container_12">
        <div class="top-select-buttons grid_1">
        </div>
        <div class="grid_8 account-links"><a href="#"><i class="icomoon" aria-hidden="true"
                                                         data-icon="&#x25df;"></i><?php echo ot_get_option('op_phone') ?>
            </a>
            <a href="mailto:<?php echo ot_get_option('op_email') ?>"><i
                    class="icon-envelope"></i><?php echo ot_get_option('op_email'); ?></a>
            <a href="#"><i class="icon-mobile-phone icon-large"></i><?php echo ot_get_option('op_hotline') ?></a>
        </div>
        <div class="grid_3 mini-cart clearfix omega right">
            <div class="click-trigger"><span class="cart-top"><i class="cart-top-icon icomoon" aria-hidden="true"
                                                                 data-icon="&#x25e0;"></i><i
                        class="icomoon down-arrow" aria-hidden="true" data-icon="&#xe00f;"></i></span>

                <div class="cart-data">Giỏ hàng<span class="count">
                            <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])):
                                echo count($_SESSION['cart']) . ' SẢN PHẨM'; ?>
                            <?php else: ?>
                                0 SẢN PHẨM
                            <?php endif; ?>
                        </span></div>
                <div class="cart-dropdown hidden_box">
                    <div id="cart-list">
                        <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) {
                            foreach ($_SESSION['cart'] as $cart_product) {
                                ?>
                                <div class="mini-product" id="mini-product-<?php echo $cart_product['id'] ?>">
                                    <div class="product-meta"><a href="<?php echo $cart_product['link']; ?>">
                                            <img src="<?php echo $cart_product['image']; ?>" alt="product-image" width="50" height="50"/>
                                            <?php echo $cart_product['name']; ?>
                                            <span class="num-price"><?php echo $cart_product['num']; ?> x <?php echo number_format($cart_product['price'], 0, ',', ','); ?> ₫</span>
                                        </a></div>
                                </div>
                                <!-- mini-product -->
                            <?php
                            } // endforeach
                        } // endif
                        ?>
                        <table class="mini-cart-total">
                            <?php
                            if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) {
                                $cart_sum = cal_total_price($_SESSION['cart']);
                            } else {
                                $cart_sum['total'] = 0;
                            } ?>
                            <tbody>
                            <tr>
                                <td class="left"><span>Tổng cộng: </span></td>
                                <td class="right">
                                    <span class="total"><?php echo number_format($cart_sum['total'], 0, ',', ','); ?> ₫</span>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <!-- end .cart-list -->
                    <div class="checkout clearfix">
                        <a class="cart left" href="<?php WP_HOME ?>/gio-hang/" title="Xem giỏ hàng"><i class="icomoon" aria-hidden="true" data-icon="&#x25e0;"></i>Xem giỏ</a>
                        <a class="check right" href="<?php WP_HOME ?>/dat-hang/" title="Đặt hàng">Đặt hàng<i class="icomoon" aria-hidden="true" data-icon="&#xe014;"></i></a>
                    </div>
                </div>
            </div>
        </div>
        <!-- end .mini-cart -->
    </div>
    <!-- end .container_12 -->
</div>
<!-- end #top-wrapper -->
<header class="<?php echo $active_option->header; ?>">
    <div class="container_12 header-inner relatived">
        <div id="logo" class="grid_3">
            <a href="<?php echo WP_HOME ?>"><img src="<?php echo THEME_URL ?>/images/logo-web.png"
                                                 alt="logo-halong"/></a></div>


        <?php
        $menu_name = 'main-menu';
        $locations = get_nav_menu_locations();
        $menu = wp_get_nav_menu_object($locations[$menu_name]);
        $menuitems = wp_get_nav_menu_items($menu->term_id, array('order' => 'DESC'));
        //var_dump($menuitems);
        ?>

        <nav class="grid_9 right omega">
            <div class="mobile-menu-trigger"><span class="icomoon mobile-icon-menu"
                                                   aria-hidden="true">&#xe008;</span><a class="menu-label">Chọn một
                    trang</a></div>
            <ul class="primary-nav">
                <?php
                wp_nav_menu(array(
                    'theme_location' => 'main-menu',
                    'container' => false,
                    'container_class' => false,
                    'menu_class' => '',
                    'container_id' => '',
                    'before' => '',
                    'after' => '',
                    'items_wrap' => '%3$s',
                    'fallback_cb' => 'wp_page_menu',
                    'walker' => new add_span_walker()
                ));
                ?>
                <li class="search-wrapper"><a href="#" aria-hidden="true" data-icon="&#x2610;"
                                              class="search-popup-trigger icomoon"></a>

                    <div id="top-search-wrapper">
                        <div class="relatived">
                            <form id="searchform" action="<?php echo esc_url(home_url('/')); ?>">
                                <input aria-hidden="true" type="submit" value="&#x2610;" id="search"
                                       class="search-button icomoon">
                                <input type="text" name="s" placeholder="Tìm kiếm..."/>
                            </form>
                        </div>
                    </div>
                </li>
            </ul>
        </nav>
    </div>
    <!-- container_12 -->
</header>

<?php// azio_change_theme_option('local.trangtrinoithat.com','trangtrinoithatsg.com') ?>